library LoadCommand initializer init requires PipedreamSSNOTDAEdition, LegacySystem

    globals
        private boolean array loaded
		private boolean LoadEnabled = false
		string array OriginalName
		
		private trigger LoadCommandTrigger 
		private string array MEDAL_AWARDED_TEXT
		private integer array MEDAL_TYPE
		private boolean array MEDAL_AWARDED
		private integer MEDAL_AWARDED_SIZE = 0
		
		private boolean awarding_medals = false
		
		private string array LoadAnimation
		private integer array LoadAnimationStage
		private string array AGTCPermutations
		private string array PlayerUniqueAGTC
    endglobals

	private function GetRNA takes integer p, integer i, integer j returns string
		if p == 0 then
			return AGTCPermutations[i + 10*j]
		else
			return AGTCPermutations[GetRandomInt(0,3)*10 + GetRandomInt(0,5)]
		endif
	endfunction
	private function RandomRNA4 takes integer i returns string
		return "|cff6d6d6d" + GetRNA(0,i,GetRandomInt(0,3)) + "|r-|cff6d6d6d" + GetRNA(0,i,GetRandomInt(0,3)) + "|r-|cff6d6d6d" + GetRNA(0,i,GetRandomInt(0,3)) + "|r-|cff6d6d6d" + GetRNA(0,i,GetRandomInt(0,3)) + "|r"
	endfunction
	private function RandomRNA3 takes integer i returns string
		return "-|cff6d6d6d" + GetRNA(0,i,2) + "|r-|cff6d6d6d" + GetRNA(0,i,3) + "|r-|cff6d6d6d" + GetRNA(0,i,0) + "|r"
	endfunction
	private function RandomRNA2 takes integer i returns string
		return "-|cff6d6d6d" + GetRNA(0,i,3) + "|r-|cff6d6d6d" + GetRNA(0,i,1) + "|r"
	endfunction
	private function RandomRNA1 takes integer i returns string
		return "-|cff6d6d6d" + GetRNA(0,i,2) + "|r"
	endfunction
	
	private function AwardMedals takes nothing returns nothing
		local integer i = 0
		if awarding_medals then
			return
		endif
		set awarding_medals = true
		call PolledWait(5.0)
		loop
			exitwhen i >= MEDAL_AWARDED_SIZE
			
			if not MEDAL_AWARDED[i] then
				set MEDAL_AWARDED[i] = true
				call DisplayTimedTextToPlayer(GetLocalPlayer(),0.0,0.0,5.0, MEDAL_AWARDED_TEXT[i])

				if MEDAL_TYPE[i] == 1 then // moh
					set udg_soundpath = "Sound\\Interface\\NewTournament.wav"
					call PlaySoundPath.execute()
					call TriggerSleepAction(15.0)
				elseif MEDAL_TYPE[i] == 2 then // DIR
					set udg_soundpath = "Sound\\Interface\\ClanInvitation.wav"
					call PlaySoundPath.execute()
					call TriggerSleepAction(10.0)
				elseif MEDAL_TYPE[i] == 3 then // service
					set udg_soundpath = "Sound\\Interface\\QuestCompleted.wav"
					call PlaySoundPath.execute()
					call TriggerSleepAction(5.0)
				else
					set udg_soundpath = "Sound\\Interface\\QuestNew.wav"
					call PlaySoundPath.execute()
					call TriggerSleepAction(5.0)
				endif
			endif
			set i = i + 1
		endloop
		set awarding_medals = false
	endfunction
	
	private function LoadingAnimationSequence takes nothing returns nothing
		local timer t = GetExpiredTimer()
		local player p = getPlayer(t, "p")
		local integer i = LoadAnimationStage[GetConvertedPlayerId(p)]
		local string s
		
		if i >= 35 then
			call DisplayTimedTextToPlayer(p,0.0,0.0,5.0, LoadAnimation[GetConvertedPlayerId(p) + 50])
			if GetLocalPlayer() == p  then
				call StartSound(gg_snd_ALICEBeep2)
			endif
			call ReleaseTimer(t)
			return
		else
			if ( p == GetLocalPlayer() ) then
				call ClearTextMessages()
			endif
			if i < 5 then
				set s = LoadAnimation[i]
			elseif i < 10 then
				set s = PlayerUniqueAGTC[GetConvertedPlayerId(p)*100 + 0] + LoadAnimation[i]
			elseif i < 15 then
				set s = PlayerUniqueAGTC[GetConvertedPlayerId(p)*100 + 1] + LoadAnimation[i]
			elseif i < 20 then
				set s = PlayerUniqueAGTC[GetConvertedPlayerId(p)*100 + 2] + LoadAnimation[i]
			elseif i < 25 then
				set s = PlayerUniqueAGTC[GetConvertedPlayerId(p)*100 + 3]
			elseif i < 27 then
				set s = PlayerUniqueAGTC[GetConvertedPlayerId(p)*100 + 4]
			elseif i < 30 then
				set s = PlayerUniqueAGTC[GetConvertedPlayerId(p)*100 + 5]
			elseif i < 33 then
				set s = PlayerUniqueAGTC[GetConvertedPlayerId(p)*100 + 6]
			elseif i < 35 then
				set s = PlayerUniqueAGTC[GetConvertedPlayerId(p)*100 + 7]
			endif

			call DisplayTimedTextToPlayer(p,0.0,0.0,1.0, s)
		endif
		
		set LoadAnimationStage[GetConvertedPlayerId(p)] = LoadAnimationStage[GetConvertedPlayerId(p)] + 1
		set t = null
		set p = null
	endfunction
	
    private function LoadSystem takes player p, string s returns nothing
        local Savecode loadcode
        
        local integer id = GetConvertedPlayerId(p)
        local boolean isvalid = true
        
        local integer xp
        local integer MOS
        local integer CR
        local integer service1
        local integer service2
        local integer service3
        local integer service4
        local integer combat1
        local integer combat2
        local integer combat3
        local integer combat4
        local integer combat5
        local integer MOH
        local integer DIR
        local string originalName = OriginalName[GetPlayerId(p)+1]
		
		local string medal_awarded_prefix = GetPlayerName(p) + " has been awarded the "
		local string serviceColor = "|cff1e90ff"
		local string combatColor = "|cff828250"
		local string MOHColor ="|cffdaa520"
		local timer t = null
        local integer techlevel = 0
        
		if LoadEnabled == false then
		    call DisplayTimedTextToPlayer(p,0.0,0.0,5.0, "Biometric ID Loading has been disabled due to time limit")
			return 
		endif
		
        if loaded[id] == true then
            call DisplayTimedTextToPlayer(p,0.0,0.0,5.0, "Biometric ID has already been loaded for ["+originalName+"]")
            return
        endif
        
        set loadcode = Savecode.create()
        if loadcode.Load(originalName,s,2) then
            //call DisplayTimedTextToPlayer(p,0.0,0.0,5.0, "Biometric ID ["+s+"] Loaded for ["+originalName+"]")
            set isvalid = true
            set udg_LoadState[id]=1337
            set loaded[id] = true
			
			set t = NewTimer()
			call TimerStart(t, 0.05, true, function LoadingAnimationSequence)
			set LoadAnimationStage[id] = 0
			set LoadAnimation[50+id] = "Biometric ID ["+s+"] Loaded for ["+originalName+"]"
			call putPlayer(t, "p", p)
			set t = null
        else
            call DisplayTimedTextToPlayer(p,0.0,0.0,5.0, "Biometric ID ["+s+"] Invalid for ["+originalName+"]")
            set isvalid = false
        endif
        
		
        if isvalid then

            set DIR = loadcode.Decode(7)
            set CR = loadcode.Decode(7)
            set MOS = loadcode.Decode(7)
            set MOH = loadcode.Decode(7)
            set service4 = loadcode.Decode(7)
            set service3 = loadcode.Decode(7)
            set service2 = loadcode.Decode(7)
            set service1 = loadcode.Decode(7)
            set combat5 = loadcode.Decode(7)
            set combat4 = loadcode.Decode(7)
            set combat3 = loadcode.Decode(7)
            set combat2 = loadcode.Decode(7)
            set combat1 = loadcode.Decode(7)
            set xp = loadcode.Decode(1000000)

			call PolledWait(0.1)
			call AwardMedals.execute()

            if combat1 >= 6 then
                // Commendation
				if combat1 == 6 then
					set MEDAL_AWARDED_TEXT[MEDAL_AWARDED_SIZE] = medal_awarded_prefix + combatColor+ udg_MedalName[1] +"|r"
					set MEDAL_AWARDED_SIZE = MEDAL_AWARDED_SIZE + 1
					set combat1 = 7
				endif
                call SetPlayerTechResearched(p, 'R00D', 1)
            endif
            
            if combat2 >= 6 then
                // bronze
				if combat2 == 6 then
					set combat2 = 7
					set MEDAL_AWARDED_TEXT[MEDAL_AWARDED_SIZE] = medal_awarded_prefix + combatColor+  udg_MedalName[2]  +"|r"
					set MEDAL_AWARDED_SIZE = MEDAL_AWARDED_SIZE + 1
				endif
                call SetPlayerTechResearched(p, 'R008', 1)
            endif
            
            if combat3 >= 6 then
                // heroism
				if combat3 == 6 then
					set combat3 = 7
					set MEDAL_AWARDED_TEXT[MEDAL_AWARDED_SIZE] = medal_awarded_prefix + combatColor+  udg_MedalName[3] +"|r" 
					set MEDAL_AWARDED_SIZE = MEDAL_AWARDED_SIZE + 1
				endif
                call SetPlayerTechResearched(p, 'R00E', 1)
            endif
            
            if combat4 >= 6 then
                // silver
				if combat4 == 6 then
					set combat4 = 7
					set MEDAL_AWARDED_TEXT[MEDAL_AWARDED_SIZE] = medal_awarded_prefix + combatColor+  udg_MedalName[4] +"|r" 
					set MEDAL_AWARDED_SIZE = MEDAL_AWARDED_SIZE + 1
				endif
                call SetPlayerTechResearched(p, 'R00F', 1)
            endif
            
            if combat5 >= 6 then
                // navy cross
				if combat5 == 6 then
					set combat5 = 7
					set MEDAL_AWARDED_TEXT[MEDAL_AWARDED_SIZE] = medal_awarded_prefix + combatColor+  udg_MedalName[5]  +"|r"
					set MEDAL_AWARDED_SIZE = MEDAL_AWARDED_SIZE + 1
				endif
                call SetPlayerTechResearched(p, 'R00G', 1)
            endif
            
            if service1 >= 6 then
                // Armed Service Commendation
				if service1 == 6 then
					set service1 = 7
					set MEDAL_AWARDED_TEXT[MEDAL_AWARDED_SIZE] = medal_awarded_prefix + serviceColor + udg_MedalName[6] + "|r"
					set MEDAL_TYPE[MEDAL_AWARDED_SIZE] = 3
					set MEDAL_AWARDED_SIZE = MEDAL_AWARDED_SIZE + 1
				endif
                call SetPlayerTechResearched(p, 'R00I', 1)
            endif
            
            if service2 >= 6 then
                // DDMS
				if service2 == 6 then
					set service2 = 7
					set MEDAL_AWARDED_TEXT[MEDAL_AWARDED_SIZE] = medal_awarded_prefix + serviceColor + udg_MedalName[7] + "|r"
					set MEDAL_TYPE[MEDAL_AWARDED_SIZE] = 3
					set MEDAL_AWARDED_SIZE = MEDAL_AWARDED_SIZE + 1
					
				endif
                call SetPlayerTechResearched(p, 'R00J', 1)
            endif

            if service3 >= 6 then
                // DDSS
				if service3 == 6 then
					set service3 = 7
					set MEDAL_AWARDED_TEXT[MEDAL_AWARDED_SIZE] = medal_awarded_prefix + serviceColor + udg_MedalName[8] + "|r"
					set MEDAL_TYPE[MEDAL_AWARDED_SIZE] = 3
					set MEDAL_AWARDED_SIZE = MEDAL_AWARDED_SIZE + 1
				endif
                call SetPlayerTechResearched(p, 'R00K', 1)
            endif
            
            if service4 >= 6 then
                // DDDS
				if service4 == 6 then
					set service4 = 7
					set MEDAL_AWARDED_TEXT[MEDAL_AWARDED_SIZE] = medal_awarded_prefix + serviceColor + udg_MedalName[9] + "|r"
					set MEDAL_TYPE[MEDAL_AWARDED_SIZE] = 3
					set MEDAL_AWARDED_SIZE = MEDAL_AWARDED_SIZE + 1
				endif
                call SetPlayerTechResearched(p, 'R00L', 1)
            endif
            
            if MOH >= 6 then
                // moh
				if MOH == 6 then
					set MOH = 7
					set MEDAL_AWARDED_TEXT[MEDAL_AWARDED_SIZE] = medal_awarded_prefix + MOHColor + udg_MedalName[10]+ "|r"
					set MEDAL_TYPE[MEDAL_AWARDED_SIZE] = 1
					set MEDAL_AWARDED_SIZE = MEDAL_AWARDED_SIZE + 1
				endif
                call SetPlayerTechResearched(p, 'R00U', 1)
            endif
            
            if DIR >= 6 then
				if DIR == 6 then
					set DIR = 7
					set MEDAL_AWARDED_TEXT[MEDAL_AWARDED_SIZE] = medal_awarded_prefix + MOHColor + udg_MedalName[13]+ "|r"
					set MEDAL_TYPE[MEDAL_AWARDED_SIZE] = 2
					set MEDAL_AWARDED_SIZE = MEDAL_AWARDED_SIZE + 1
				endif
				call SetPlayerTechResearched(p, 'R00X', 1)
                // dir
            endif
			
            call PolledWait(0.1)
			
            set udg_Experience[id] = xp
            set udg_InitialExperience[id] = udg_Experience[id]

            if udg_Hero[id]!=null and GetUnitTypeId(udg_Hero[id])!='h00E' then
                // call UnitAddAbility(udg_Hero[i],'A004') //Leadership
            endif
        
            if xp >= 65000 then
                call IncUnitAbilityLevel(udg_Hero[id],'A06H') //Colt
                call IncUnitAbilityLevel(udg_Hero[id],'A07P') //Desert Eagle
            endif
        
            if xp >= 0 then
                // private
				 set techlevel = techlevel + 1
            endif
            
            if xp >= 500 then
                // first class private
                call SetPlayerUnitAvailableBJ('H005', true, p)
                call SetPlayerUnitAvailableBJ('H003', true, p)
                call SetPlayerUnitAvailableBJ('H007', true, p)
                set techlevel = techlevel + 1
            endif

            if xp >= 1500 then
                // lance corporal
                set techlevel = techlevel + 1
            endif
            
            if xp >= 5000 then
                // corporal
                call SetPlayerUnitAvailableBJ('H00N', true, p)
                set techlevel = techlevel + 1
            endif
            
            if xp >= 10000 then
                // sergeant 
                call SetPlayerUnitAvailableBJ('H006', true, p)
                set techlevel = techlevel + 1
            endif
            
            if xp >= 20000 then
                // staff sergeant 
				call SetPlayerHandicap(Player(14),GetPlayerHandicap(Player(14))+0.01)
				call SetPlayerHandicap(Player(13),GetPlayerHandicap(Player(13))+0.01)
                call SetPlayerUnitAvailableBJ('H00J', true, p)
                set techlevel = techlevel + 1
            endif
     
            if xp >= 35000 then
                // gunnery sergeant 
                call SetPlayerUnitAvailableBJ('H00O', true, p)
                call SetPlayerUnitAvailableBJ('H004', true, p)
                set techlevel = techlevel + 1
            endif
            
            if xp >= 50000 then
                // second liutenant
                set techlevel = techlevel + 1
            endif
            
            if xp >= 65000 then
                // first liutenant
                set techlevel = techlevel + 1
            endif
            
            if xp >= 80000 then
                // captain
                call SetPlayerUnitAvailableBJ('H008', true, p)
				call SetPlayerHandicap(Player(14),GetPlayerHandicap(Player(14))+0.01)
				call SetPlayerHandicap(Player(13),GetPlayerHandicap(Player(13))+0.01)
                set techlevel = techlevel + 1
            endif
            
            if xp >= 120000 then
                // major
				call SetPlayerHandicap(Player(14),GetPlayerHandicap(Player(14))+0.01)
				call SetPlayerHandicap(Player(13),GetPlayerHandicap(Player(13))+0.01)
                set techlevel = techlevel + 1
            endif
            
            if xp >= 180000 then
                //liutenant colonel
                set techlevel = techlevel + 1
            endif
            
            if xp >= 240000 then
                // colonel
                set techlevel = techlevel + 1
            endif

            if xp >= 300000 then
                // brigadier general
                set techlevel = techlevel + 1
            endif
            
            if xp >= 400000 then
                // major general
                set techlevel = techlevel + 1
            endif
            
            if xp >= 500000 then
                // lt. general
                set techlevel = techlevel + 1
            endif
			
            if xp >= 600000 then
                // general
                set techlevel = techlevel + 1
            endif
			
            call SetPlayerTechResearchedSwap( 'Rhpt', techlevel, p )
			//call SetPlayerTechResearchedSwap( 'R014', MOS, p )
            call SetPlayerTechResearchedSwap( 'R015', CR, p )
			call SetPlayerHandicapXPBJ( p, 72.0 + I2R(CR)*4.0 )
			
			call SetI("service1", id, service1)
			call SetI("service2", id, service2)
			call SetI("service3", id, service3)
			call SetI("service4", id, service4)
			
			call SetI("combat1", id, combat1)
			call SetI("combat2", id, combat2)
			call SetI("combat3", id, combat3)
			call SetI("combat4", id, combat4)
			call SetI("combat5", id, combat5)
			
			call SetI("MOH", id, MOH)
			call SetI("DIR", id, DIR)
			
			call SetI("player mos", id, MOS)
            call SetI("Rank", id, techlevel - 1)

            call RankSet(id, true) 
        endif 

    endfunction

    private function Trig_test_savecode_Actions takes nothing returns nothing
        local string raw = GetEventPlayerChatString() 
        local string code1 = SubString(raw,6,12)+SubString(raw,13,StringLength(raw))
        local player p = GetTriggerPlayer()
		
		if StringLength(code1) > 12 then
			set code1 = SubString(code1,0,12)
		endif
		
        call LoadSystem(p,code1)
        set p = null
    endfunction
    
    private function SetNameActions takes nothing returns nothing
        local string raw = GetEventPlayerChatString()
        //local string code1 = SubString(raw,6,StringLength(raw))
        local string name = SubString(raw,9,StringLength(raw))
        local player p = GetTriggerPlayer()
        call BJDebugMsg ("name set to " + name)
        call SetPlayerName(p,name)
    endfunction
    
	private function Shift takes nothing returns nothing
		local trigger t
		local integer id = 1
		local integer playerindex 
		local integer hash
		
		local integer i 
		local integer j
		
		// a starting
		set AGTCPermutations[0] = "AGTC"
		set AGTCPermutations[1] = "AGCT"
		set AGTCPermutations[2] = "ACTG"
		set AGTCPermutations[3] = "ACGT"
		set AGTCPermutations[4] = "ATGC"
		set AGTCPermutations[5] = "ATCG"
		// g starting
		set AGTCPermutations[10] = "GATC"
		set AGTCPermutations[11] = "GACT"
		set AGTCPermutations[12] = "GTAC"
		set AGTCPermutations[13] = "GTCA"
		set AGTCPermutations[14] = "GCTA"
		set AGTCPermutations[15] = "GCAT"
		// c starting
		set AGTCPermutations[20] = "CAGT"
		set AGTCPermutations[21] = "CATG"
		set AGTCPermutations[22] = "CGTA"
		set AGTCPermutations[23] = "CGAT"
		set AGTCPermutations[24] = "CTAG"
		set AGTCPermutations[25] = "CTGA"
		// t starting
		set AGTCPermutations[30] = "TGAC"
		set AGTCPermutations[31] = "TGCA"
		set AGTCPermutations[32] = "TCAG"
		set AGTCPermutations[33] = "TCGA"
		set AGTCPermutations[34] = "TAGC"
		set AGTCPermutations[35] = "TACG"
		
		//set LoadAnimation[0]  = "|cff1e90ff|r|cff6d6d6dAGTC-AGTC-AGTC-AGTC|r"
		set LoadAnimation[0]   = RandomRNA4(0)
		set LoadAnimation[1]   = RandomRNA4(1)
		set LoadAnimation[2]   = RandomRNA4(2)
		set LoadAnimation[3]   = RandomRNA4(3)
		set LoadAnimation[4]   = RandomRNA4(4)
		set LoadAnimation[5]   = RandomRNA3(5)
		set LoadAnimation[6]   = RandomRNA3(0)
		set LoadAnimation[7]   = RandomRNA3(1)
		set LoadAnimation[8]   = RandomRNA3(2)
		set LoadAnimation[9]   = RandomRNA3(3)
		set LoadAnimation[10]  = RandomRNA2(4)
		set LoadAnimation[11]  = RandomRNA2(5)
		set LoadAnimation[12]  = RandomRNA2(0)
		set LoadAnimation[13]  = RandomRNA2(1)
		set LoadAnimation[14]  = RandomRNA2(2)
		set LoadAnimation[15]  = RandomRNA1(3)
		set LoadAnimation[16]  = RandomRNA1(4)
		set LoadAnimation[17]  = RandomRNA1(5)
		set LoadAnimation[18]  = RandomRNA1(0)
		set LoadAnimation[19]  = RandomRNA1(1)

		set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent( t, Player(0), "-load", false )
        call TriggerRegisterPlayerChatEvent( t, Player(1), "-load", false )
        call TriggerRegisterPlayerChatEvent( t, Player(2), "-load", false )
        call TriggerRegisterPlayerChatEvent( t, Player(3), "-load", false )
        call TriggerRegisterPlayerChatEvent( t, Player(4), "-load", false )
        call TriggerRegisterPlayerChatEvent( t, Player(5), "-load", false )
        call TriggerRegisterPlayerChatEvent( t, Player(6), "-load", false )
        call TriggerRegisterPlayerChatEvent( t, Player(7), "-load", false )
        call TriggerRegisterPlayerChatEvent( t, Player(8), "-load", false )
        call TriggerRegisterPlayerChatEvent( t, Player(9), "-load", false )
        call TriggerRegisterPlayerChatEvent( t, Player(10), "-load", false )
        call TriggerRegisterPlayerChatEvent( t, Player(11), "-load", false )
        call TriggerAddAction( t, function Trig_test_savecode_Actions )
        set LoadCommandTrigger= t 
		
        set t = CreateTrigger()
        call TriggerRegisterPlayerChatEvent( t, Player(0), "-setname ", false )
        call TriggerAddAction( t, function  SetNameActions  )
        call DisableTrigger(t)

		set id = 1
		loop
			exitwhen id > 12
			
			if GetPlayerSlotState(Player(id-1)) != PLAYER_SLOT_STATE_EMPTY and GetPlayerController(Player(id-1)) == MAP_CONTROL_USER then
				
				set OriginalName[id] = GetPlayerName(Player(id-1))
				call SetI("Rank", id, 0)
				call SetI("player mos", id, 0)
				call SetPlayerName(ConvertedPlayer(id),"Pvt. " + OriginalName[id])
				call SetS("PNames",id,OriginalName[id])
				
				call TriggerSleepAction(0.1)
				set hash = StringHash(OriginalName[id])
				if hash < 0 then
					set hash = -1*hash
				endif
				set playerindex = id*100
				
				set i = ModuloInteger(hash,5)
				set hash = hash / 5
				set j = ModuloInteger(hash,3)
				set hash = hash / 3
				set PlayerUniqueAGTC[playerindex + 10] = AGTCPermutations[i + 10*j] 

				set i = ModuloInteger(hash,5)
				set hash = hash / 5
				set j = ModuloInteger(hash,3)
				set hash = hash / 3
				set PlayerUniqueAGTC[playerindex + 11] = AGTCPermutations[i + 10*j] 
			
				set i = ModuloInteger(hash,5)
				set hash = hash / 5
				set j = ModuloInteger(hash,3)
				set hash = hash / 3
				set PlayerUniqueAGTC[playerindex + 12] = AGTCPermutations[i + 10*j] 
		
				set i = ModuloInteger(hash,5)
				set hash = hash / 5
				set j = ModuloInteger(hash,3)
				set PlayerUniqueAGTC[playerindex + 13]= AGTCPermutations[i + 10*j] 

				call TriggerSleepAction(0.1)
				set PlayerUniqueAGTC[playerindex + 20] = "|cff1e90ff" + PlayerUniqueAGTC[playerindex + 10] + "|r"
				set PlayerUniqueAGTC[playerindex + 21] = "|cff1e90ff" + PlayerUniqueAGTC[playerindex + 11] + "|r"
				set PlayerUniqueAGTC[playerindex + 22] = "|cff1e90ff" + PlayerUniqueAGTC[playerindex + 12] + "|r"
				set PlayerUniqueAGTC[playerindex + 23] = "|cff1e90ff" + PlayerUniqueAGTC[playerindex + 13] + "|r"
				
				set PlayerUniqueAGTC[playerindex + 30] = "|cff00ff00" + PlayerUniqueAGTC[playerindex + 10] + "|r"
				set PlayerUniqueAGTC[playerindex + 31] = "|cff00ff00" + PlayerUniqueAGTC[playerindex + 11] + "|r"
				set PlayerUniqueAGTC[playerindex + 32] = "|cff00ff00" + PlayerUniqueAGTC[playerindex + 12] + "|r"
				set PlayerUniqueAGTC[playerindex + 33] = "|cff00ff00" + PlayerUniqueAGTC[playerindex + 13] + "|r"
				
				set PlayerUniqueAGTC[playerindex + 0] = PlayerUniqueAGTC[playerindex + 20]
				set PlayerUniqueAGTC[playerindex + 1] = PlayerUniqueAGTC[playerindex + 0] + "-" + PlayerUniqueAGTC[playerindex + 21]
				set PlayerUniqueAGTC[playerindex + 2] = PlayerUniqueAGTC[playerindex + 1] + "-" + PlayerUniqueAGTC[playerindex + 22]
				set PlayerUniqueAGTC[playerindex + 3] = PlayerUniqueAGTC[playerindex + 2] + "-" + PlayerUniqueAGTC[playerindex + 23]
				
				set PlayerUniqueAGTC[playerindex + 4] = PlayerUniqueAGTC[playerindex + 30]  + "-" + PlayerUniqueAGTC[playerindex + 21] + "-" + PlayerUniqueAGTC[playerindex + 22] + "-" + PlayerUniqueAGTC[playerindex + 23]
				set PlayerUniqueAGTC[playerindex + 5] = PlayerUniqueAGTC[playerindex + 30]  + "-" + PlayerUniqueAGTC[playerindex + 31] + "-" + PlayerUniqueAGTC[playerindex + 22] + "-" + PlayerUniqueAGTC[playerindex + 23]
				set PlayerUniqueAGTC[playerindex + 6] = PlayerUniqueAGTC[playerindex + 30]  + "-" + PlayerUniqueAGTC[playerindex + 31] + "-" + PlayerUniqueAGTC[playerindex + 32] + "-" + PlayerUniqueAGTC[playerindex + 23]
				set PlayerUniqueAGTC[playerindex + 7] = PlayerUniqueAGTC[playerindex + 30]  + "-" + PlayerUniqueAGTC[playerindex + 31] + "-" + PlayerUniqueAGTC[playerindex + 32] + "-" + PlayerUniqueAGTC[playerindex + 33]
			endif
			
			set id = id + 1
		endloop
		
		set LoadEnabled = true	
	endfunction
	
	function SetLoadCommandEnabled takes boolean b returns nothing
		set LoadEnabled = b
	endfunction

    private function init takes nothing returns nothing
		local trigger t = CreateTrigger()
		call TriggerRegisterTimerEvent(t, 0.15, false)
		call TriggerAddAction(t, function Shift)
    endfunction
    
endlibrary

